using System.Collections.Generic;
using System.Web;

namespace Limestone
{
    public interface IPageProvider
    {
        IStorage Storage { get; set; }
        IGetCurrentUserId GetCurrentUserId { get; set; }
        IPageStubCache PageStubCache { get; set; }

        /// <summary>
        /// Returns the current page
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        IPage GetCurrentPage(HttpContext context);

        /// <summary>
        /// Loads and returns a full page object.
        /// For quick look ups, use GetPageStub instead
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        IPage Get(string path);

        /// <summary>
        /// Loads a full page from a stub
        /// </summary>
        /// <param name="stub"></param>
        /// <returns></returns>
        IPage ExpandToPage(IPageStub stub);

        /// <summary>
        /// persists the page to storage
        /// </summary>
        /// <returns></returns>
        IPage Save(IPage page);

        /// <summary>
        /// Creates a new page beneath the current page
        /// </summary>
        /// <param name="page"> </param>
        /// <param name="title"></param>
        /// <returns></returns>
        IPage CreateChildPage(IPage page, string title);

        /// <summary>
        /// Returns the parent page
        /// </summary>
        /// <returns></returns>
        IPage GetParent(IPage page);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"> </param>
        /// <param name="newParentPath"></param>
        bool Move(IPage page, string newParentPath);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"> </param>
        /// <param name="targetParentPath"></param>
        bool Copy(IPage page, string targetParentPath);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"> </param>
        /// <param name="targetParentPage"></param>
        bool Copy(IPage page, IPage targetParentPage);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        bool Delete(IPage page);
        bool Delete(string pagePath);

        IEnumerable<IPageStub> GetChildPages(string pagePath, bool excludeHidden);
        IEnumerable<IPageStub> GetChildPages(IPage page, bool excludeHidden);
        
        IPageStub ToPageStub(IPage page);
    }
}